#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>

int KMPInit(const char* str, int next[]);

int main(int argc, char* argv[])
{
	const int arrayNum = 1000001; // 1 million
	char *str = new char[arrayNum];
	memset(str, 0, sizeof(char) * arrayNum);
	int *next = new int[arrayNum];
	memset(next, 0, sizeof(int) * arrayNum);

	while (scanf("%s", str), str[0] != '.')
	{
		KMPInit(str, next);

		int len = strlen(str);
		int n = 1;
		int leftn = len - (next[len - 1]);
		if (len % leftn == 0)
			n = len / leftn;
		printf("%d\n", n);

		memset(str, 0, sizeof(char) * arrayNum);
		memset(next, 0, sizeof(int) * arrayNum);
	}

	delete []str;
	str = NULL;
	delete []next;
	next = NULL;

	return 0;
}

int KMPInit(const char* str, int* next)
{
	assert(str && next);

	int idx = 1, nextIdx = 0;
	next[0] = 0;
	int len = strlen(str);
	for ( ; idx < len; ++idx ) 
	{
		if ( str[idx] == str[nextIdx] ) 
			next[idx] = ++nextIdx;
		else
			next[idx] = nextIdx = 0;
	}

	return 0;
}
